package com.itheima.Jiuye14;

import java.util.concurrent.CountDownLatch;

public class Test {
    public static void main(String[] args) {
        //底层会创建一个计时器，计数器的值结算3，
        CountDownLatch countDownLatch = new CountDownLatch(3); //创建线程控制对象，参数为：等待几个线程执行完毕，再唤醒等待的线程
        Chile1 chile1 = new Chile1(countDownLatch);
        Chile2 chile2 = new Chile2(countDownLatch);
        Chile3 chile3 = new Chile3(countDownLatch);
        Mother m = new Mother(countDownLatch);
//        Thread thread = new Thread(chile1);
//        Thread thread1 = new Thread(chile2);
//        Thread thread2 = new Thread(chile3);
//        thread.start();
//        thread1.start();
//        thread2.start();
        chile1.setName("小红");
        chile1.start();
        chile2.setName("小明");
        chile2.start();
        chile3.setName("小刘");
        chile3.start();
        m.start();
    }
}
